package it.avantsoft.ls.gl.data;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class ListAllowedPeer {
    private List<String> allowedChild;

    public ListAllowedPeer() {
        allowedChild = new ArrayList<String>();
    }

    public boolean addAllowedPeer(String childId) {
        return allowedChild.add(childId);
    }


    public boolean removeAllowedPeer(String childId) {
        return allowedChild.remove(childId);
    }

    public boolean isAllowed(String childId) {
        return allowedChild.contains(childId);
    }

    public Set<String> getSet() {
        Set s = new HashSet<String>();
        for (int i = 0; i < allowedChild.toArray().length; i++) {
            Object o = allowedChild.toArray()[i];
            s.add(o);
        }
        return s;
    }


    public String toString() {
        return "ListAllowedPeer{" +
                "allowedChild=" + allowedChild +
                '}';
    }
}
